﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CarShop.Domain.Entities;

namespace CarShop.Data.EntityFramework.Mappings
{
    internal class CarBrandConfiguration : EntityBaseConfiguration<CarBrand, int>
    {
        public CarBrandConfiguration()
        {
            Property(c => c.Name).IsRequired().HasMaxLength(100);
            Property(c => c.Description).IsRequired();

            HasOptional(c => c.Picture).WithMany().HasForeignKey(c => c.PictureId);
            HasMany(c => c.Cars).WithRequired(c => c.CarBrand).HasForeignKey(c => c.CarBrandId);
        }
    }
}
